﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ShevaEngine.Core.Modules.Graphics
{
    /// <summary>
    /// Graphics buffers handle.
    /// </summary>
    public class GraphicsBuffersHandle
    {
        /// <summary>Vertex buffer ID.</summary>
        internal int VboID;
        /// <summary>Vertex buffer ID.</summary>
        internal int IboID;

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="vboID"></param>
        /// <param name="iboID"></param>
        public GraphicsBuffersHandle(int vboID, int iboID)
        {
            this.VboID = vboID;
            this.IboID = iboID;
        }
    }

    /// <summary>
    /// Graphics buffers handle comparer.
    /// </summary>
    public class GraphicsBuffersHandleComparer : IComparer<GraphicsBuffersHandle>
    {
        /// <summary>
        /// Method compares two Graphics buffers handles.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public int Compare(GraphicsBuffersHandle x, GraphicsBuffersHandle y)
        {
            if (x.VboID != y.VboID)
                return Math.Sign(y.VboID - x.VboID);
            else
                return Math.Sign(y.IboID - x.IboID);
        }
    }
}
